﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ClassLibrary1.DAO;
using ClassLibrary1.Entity;


namespace Bilyteam_Website.Admin
{
    public partial class TeamEdit : System.Web.UI.Page
    {
         private Teams tem;
        private TeamsDAO temdao;
        public TeamEdit()
        {
            tem = new Teams();
            temdao= new TeamsDAO();
        }
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                string temID = Request["temsID"];
                if (temID != null)
                {
                    tem = temdao.GetTeamById(int.Parse(temID));
                    txtid.Text = tem.TeamsID.ToString();
                    txtteamname.Text = tem.TeamName;
                    txtteamemail.Text = tem.TeamEmail;
                    txttotalemail.Text = tem.TotalEmail.ToString();


                }
            }

        }

        protected void btnupdate_Click(object sender, EventArgs e)
        {
            Teams tem = new Teams();
            tem.TeamsID = Utility.ToInt(txtid.Text);
            tem.TeamName = txtteamname.Text;
            tem.TeamEmail = txttotalemail.Text;
            tem.TotalEmail = Int32.Parse(txttotalemail.Text);
            temdao.Updae(tem);
            Response.Redirect("TeamsManager.aspx");
        }
    }
}